# cli/cli/cli_client.py

import rclpy
from rclpy.node import Node
from std_srvs.srv import SetBool

class NumberClient(Node):
    def __init__(self):
        super().__init__('number_client')
        self.cli = self.create_client(SetBool, 'process_numbers')
        while not self.cli.wait_for_service(timeout_sec=1.0):
            self.get_logger().info('service not available, waiting again...')
        self.req = SetBool.Request()

    def send_request(self, operation):
        self.req.data = operation
        self.future = self.cli.call_async(self.req)
        rclpy.spin_until_future_complete(self, self.future)
        return self.future.result()

def main(args=None):
    rclpy.init(args=args)
    node = NumberClient()
    operation = True  # Change to False for product
    response = node.send_request(operation)
    node.get_logger().info('Result: %s' % response.message)
    rclpy.shutdown()

if __name__ == '__main__':
    main()
